<!DOCTYPE html>
<html lang="cs">
	<head>
		<meta charset="utf-8" />
		<title>Příklad 1-9</title>
		<meta name="author" content="Daniel Bielczyk" />
    
    <script src="libs/raphael.js"></script>
    
	</head>
	<body style="margin: 0; padding: 0;">
		
    <span id="canvas"></span>

<script>

var canvas = Raphael("canvas", 200, 200);

var rect = canvas.rect(10, 10, 50, 50);
rect.attr({
  fill: "#ff0000",
  stroke: "#000000"
});

var rotateRect = function() {
  rect.attr("transform", "r0");
  rect.animate({
    transform: "r360"
  }, 4000, rotateRect);
};
rotateRect();

var animate = true;
rect.click(function() {
  if (animate) {
    rect.pause();
  } else {
    rect.resume();
  }
  
  animate = !animate;
});

</script>
    
	</body>
</html>